#!/bin/sh /etc/rc.common
# STUN client software
# Copyright (C) 2015-2019 iopsys Software Solutions AB
# Author: Omar Kallel <omar.kallel@pivasoftware.com>

START=90

USE_PROCD=1
PROG="/usr/sbin/icwmp_stund"

start_service() {
	local server=`uci -q get cwmp_stun.stun.server_address`
	[ "$server" = "" ] && exit 0
	procd_open_instance
	procd_set_param command "$PROG"
	procd_set_param respawn "3" "7" "0"
	procd_close_instance
}

boot() {
	start
}

reload_service() {
	logger -p crit -t "cwmp_stun" "reloading service()"
	stop
	start 
}

service_triggers()
{
	procd_add_reload_trigger cwmp_stun
}
